//
//  BaseViewController.swift
//  SwitfTest
//
//  Created by runone02 on 2018/12/28.
//  Copyright © 2018年 liqiyun. All rights reserved.
//

import UIKit

class BaseViewController: UIViewController {
    var t_barTintColor:UIColor?
    
    override func viewDidLoad() {
        super.viewDidLoad()

        view.backgroundColor = kTableviewBackgroundColor
        if let ishide = self.navigationController?.navigationBar.isHidden{
            if ishide{
                let _topBg = UIView .init(frame: CGRect(x: 0, y: 0, width: SCREEN_WIDTH, height: 64))
                _topBg.backgroundColor = UIColor.white
                view.addSubview(_topBg)
                
                let backbtn = UIButton(frame: CGRect(x: 15, y: 27, width: 30, height: 30))
                backbtn.setImage(UIImage(named: "leftbackicon_sdk_login"), for: .normal)
               
                backbtn.imageEdgeInsets = UIEdgeInsets(top: 0, left: -10, bottom: 0, right: 10)
                _topBg.addSubview(backbtn)
                _topBg.backgroundColor = RGBAlpa(1, 2, 1, 1)
                
            }         
        }
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    func addRightNavingationItem() {
        let backBtn = UIButton(frame: CGRect(x: 0, y: 0, width: 40, height: 30))
        backBtn.setImage(UIImage(named: "more_toolbar_press"), for: .normal)
        backBtn.imageEdgeInsets = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: 0)
        backBtn.addTarget(self, action: #selector(_rightItemAction), for: .touchUpInside)
        let leftitem = UIBarButtonItem.init(customView: backBtn)
        navigationItem.rightBarButtonItem = leftitem
   
    }
    
    /// 右侧按钮点击
    @objc func _rightItemAction(){
        print("右侧按钮点击")
    }
    /*
    // MARK: - Navigation

    // In a storyboard-based application, you will often want to do a little preparation before navigation
    override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
        // Get the new view controller using segue.destinationViewController.
        // Pass the selected object to the new view controller.
    }
    */

}
